package offer.binarytree;

/**
 * Description：
 * Author: zhangc
 * Date：2017/7/27 15:35
 */
public class TreeDepth39 {

    public static <T> int getTreeDepth(BinaryTree<T> head) {
        if (head == null)
            return 0;
        int left = getTreeDepth(head.left);
        int right = getTreeDepth(head.right);
        return left > right ? left + 1 : right + 1;
    }

}
